<template>
	<view class="age">
		<rich-text :nodes="html"></rich-text>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				html:'',
				lang:'zh'
			}
		},
		onShow() {
			this.nowLang = this.$i18n.locale
			// 获取当权语言
			this.getLang()
		},
		methods:{
			// 获取隐私政策
			getData(){
				this.$u.api.basic.getContentData({
					type:this.nowLang==='zh'?'隐私政策':'隐私政策(俄)',
					nowLang:this.$i18n.locale
				}).then(res => {
					this.html = res.content
				})
			},
			// 获取当权语言
			getLang() {
				// 获取缓存lang当前语言值
				uni.getStorage({
					key: 'lang',
					success: res => {
						if (res.data == 'zh') { //zh为中国，赋值0
							this.lang = 'zh'
						} else { //其他为俄罗斯，赋值1
							this.lang = 'ru'
						}
					}
				});
				this.getData()
			},
		},
		onReady() {
			uni.setNavigationBarTitle({		//自定义标题
				title: this.nowLang==='zh'?this.$t('隐私协议'):this.$t('Политика конфиденциальности')
			})
		}
	}
</script>

<style lang="scss" scoped>
	.age{
		padding:15rpx 35rpx 35rpx 35rpx;
	}
</style>